<?php
!defined('P_W') && exit('Forbidden');
class PW_TypeDataBBS {
	
	function getData($config) {
		$hid = (int)$config['hid'];
		$model = $config['model'];
		if (!$hid) return array();
		$num = (int)$config['num'] ? (int) $config['num'] : 10;
		$temp = $this->_getDataFromPushData($hid,$model,$num);
		$count = count($temp);
		if ($count == $num) {
			return $temp;
		}
		$temp_2 = $this->_getDataFromBBS($hid,$num-$count);
		return array_merge($temp,$temp_2);

	}
	
	function _getDataFromPushData($hid,$model,$num) {
		$service = House::loadClass('pushdataservice','service');
		$temp = $service->getOpenPushs($hid,$model,$num);
		foreach ($temp as $key=>$value) {
			$temp[$key]['postdate'] = $value['pushtime'];
		}
		return $temp;
	}
	
	function _getDataFromBBS($hid,$count) {
		
	}
	function _initData($data) {
		$data['url'] = 'read.php?tid='.$data['tid'];
		$data['tid'] = $data['tid'];
		$data['postdate'] = get_date($data['postdate'],'Y-m-d');
		$data['title'] = substrs($data['subject'],40);
		return $data;
	}
	

}
?>